package com.mianle.userapi.util.communion;

import com.spatial4j.core.context.SpatialContext;
import com.spatial4j.core.distance.DistanceUtils;

public class App {

    public static void main(String[] args) {
        long start = System.currentTimeMillis();
        System.out.println(new GeoHashHelper().around(44.9999, 116.3967));
        System.out.println(new GeoHashHelper().around(45.0001, 116.3967));
        System.out.println(DistanceHepler.distance(44.9999, 116.3967, 45.0001, 116.3967));
        System.out.println("waste time: " + (System.currentTimeMillis() - start));
        // long start = System.currentTimeMillis();
        // System.out.println(new GeoHashHelper().encode(44.9999, 116.3967));
        // System.out.println(new GeoHashHelper().encode(45.0001, 116.3967));
        // System.out.println("waste time: " + (System.currentTimeMillis() - start));

        System.out.println("------------------------------------------------------------------------------");
        //28.229481000000, 112.880323000000
        // System.out.println(new GeoHashHelper().encode(28.229481000000, 112.880323000000));
        // System.out.println(new GeoHashHelper().around(28.229481000000, 112.880323000000));

        SpatialContext geo = SpatialContext.GEO;
        double distance = geo.calcDistance(geo.makePoint(112.880114000000, 28.229365000000), geo.makePoint(112.877159000000, 28.229760000000))
                * DistanceUtils.DEG_TO_KM;
        System.out.println(distance);

        System.out.println(DistanceHepler.distance(28.229365000000, 112.880114000000, 28.229760000000, 112.877159000000));

        //System.out.println(getDistance(28.229365000000, 112.880114000000, 28.229760000000, 112.877159000000));

    }








}
